import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JqtCpHtOrderAccountVO, JqtCpHtOrderAccountForm, JqtCpHtOrderAccountQuery } from '@/api/bus/jqtCpHtOrderAccount/types';
import { BindHtUserBo } from '@/views/bus/jqtCpHtOrderAccount/index.vue';

/**
 * 查询企业互通订单账号列表
 * @param query
 * @returns {*}
 */

export const listJqtCpHtOrderAccount = (query?: JqtCpHtOrderAccountQuery): AxiosPromise<JqtCpHtOrderAccountVO[]> => {
  return request({
    url: '/bus/jqtCpHtOrderAccount/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询企业互通订单账号详细
 * @param id
 */
export const getJqtCpHtOrderAccount = (id: string | number): AxiosPromise<JqtCpHtOrderAccountVO> => {
  return request({
    url: '/bus/jqtCpHtOrderAccount/' + id,
    method: 'get'
  });
};

/**
 * 新增企业互通订单账号
 * @param data
 */
export const addJqtCpHtOrderAccount = (data: JqtCpHtOrderAccountForm) => {
  return request({
    url: '/bus/jqtCpHtOrderAccount',
    method: 'post',
    data: data
  });
};

/**
 * 修改企业互通订单账号
 * @param data
 */
export const updateJqtCpHtOrderAccount = (data: JqtCpHtOrderAccountForm) => {
  return request({
    url: '/bus/jqtCpHtOrderAccount',
    method: 'put',
    data: data
  });
};

/**
 * 删除企业互通订单账号
 * @param id
 */
export const delJqtCpHtOrderAccount = (id: string | number | Array<string | number>) => {
  return request({
    url: '/bus/jqtCpHtOrderAccount/' + id,
    method: 'delete'
  });
};


/**
 * 账号绑定互通用户
 * @param data
 */
export const bindHtUser = (data:BindHtUserBo) => {
  return request({
    url: '/bus/jqtCpHtOrderAccount/bindHtUser',
    method: 'put',
    data: data
  });
};
